#include<iostream>
using namespace std;
const int N = 110;
int s[N][N];
int n;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> s[i][j];
			s[i][j] += s[i - 1][j];
		}
	}
	int ma = -1e9;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j++) {
			int last = 0;
			for (int k = 1; k <= n; k++) {
				last = max(last, 0) + s[j][k] - s[i - 1][k];
				ma = max(last, ma);
			}
		}
	}
	cout << ma << endl;
	return 0;
}